package com.atguigu.guliguli.product.entity;

import com.atguigu.guliguli.common.valid.AddGroup;
import com.atguigu.guliguli.common.valid.ListValue;
import com.atguigu.guliguli.common.valid.UpdateGroup;
import com.atguigu.guliguli.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.Value;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @author: 叶子
 * @date: 2021/11/27 14:57
 **/
@Data
public class BrandEntity implements Serializable {

    private static final long serialVersionUID = 5851254258702780684L;
    @NotNull(message = "修改必须指定品牌id",groups = {UpdateGroup.class})
    @Null(message = "新增不能指定id",groups = {AddGroup.class})
    @TableId
    private Long brandId;
    @NotBlank(message = "品牌名必须提交",groups = {AddGroup.class,UpdateGroup.class})
    private String name;
    @NotBlank(groups = {AddGroup.class})
    @URL(message = "logo必须是一个合法的url地址",groups = {AddGroup.class,UpdateGroup.class})
    private String logo;
    private String descript;
    @NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
    @ListValue(vals={0,1},groups = {AddGroup.class,UpdateStatusGroup.class})
    private Integer showStatus;
    @NotEmpty(groups = {AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母",groups = {AddGroup.class})
    private String firstLetter;
    @NotNull(groups = {AddGroup.class})
    @Min(value=0,message = "排序必须大于等于0",groups = {AddGroup.class,UpdateGroup.class})
    private Integer sort;

}